/*
 * Copyright (C) 2024-2025 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include "widgets/ddialog.h"

#include <QObject>
#include <QMap>

class DBusInvokerInterface;
class SettingsInvokerInterface;


class SecurityToolsModel : public QObject
{
    Q_OBJECT
public:
    explicit SecurityToolsModel(QObject *parent = nullptr);
    ~SecurityToolsModel();

    // 资源管理接口是否可用
    bool isResourceManagerValid();
    // 获取ima状态
    int getIMAStatus();
    // 获取执行保护模块状态
    bool getExeFilesStatus();

    // 系统安全等级按钮是否显示
    bool isShowSystemLevelUi();

    // 是否允许进行执行保护
    bool isAllowExeFilesProtection();

    // 是否允许进行外设管控
    bool isAllowPeripheralsManage();
    // 是否显示外设管控入口
    bool isShowPeripheralManage();

    // selinux是否开启
    bool isSelinuxOpen();

    // 开启selinux
    void oepnSelinux();

private:
    // 初始化数据
    void initData();

private:
    DBusInvokerInterface *m_dataInterDbusInvoker; // 数据中心dbus
    DBusInvokerInterface *m_imaDbusInvoker; // 数据中心dbus
    bool m_isResourceManagerValid;

    QString m_sLevelStatus;
    bool m_isLevelShow;
    bool m_isValidSecurityEnhance;
    DBusInvokerInterface *m_systemLevelDBusInter; // 安全中心等保服务接口
    SettingsInvokerInterface *m_gsetting; // 安全中心gsetting配置

    DBusInvokerInterface *m_exeFilesDBusInter; // 执行保护服务接口
    DBusInvokerInterface *m_accountsDBusInter;
    QMap<QString, DBusInvokerInterface *> m_accountInterMap;

    DBusInvokerInterface *m_peripheralsDBusInter; // 外设管理服务接口
    DBusInvokerInterface *m_policyManagerDBusInter; // 外设管理策略服务接口
    DBusInvokerInterface *m_rootSystemDBusInter; // 重启服务接口
};
